x86/time: calibrate TSC against platform timer
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Aug 2016 08:02:52 +0000 (10:02 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Aug 2016 08:02:52 +0000 (10:02 +0200)
commit93340297802b8e743b6ce66b0bc366af1ad51f39
tree6d208e061e67ab60b85124ae9e905b3fbd0c6bbc
parentda25b27bd7872612ab57a22a47913c68f43e3910
x86/time: calibrate TSC against platform timer

... instead of unconditionally against the PIT. This allows for local
and master system times to remain in better sync (which matters even
when, on any modern system, the master time is really used only during
secondary CPU bringup, as the error between the two is in fact
noticable in cross-CPU NOW() invocation monotonicity).

This involves moving the init_platform_timer() invocation into
early_time_init(), splitting out the few things which really need to be
done in init_xen_time(). That in turn allows dropping the open coded
PIT initialization from init_IRQ() (it was needed for APIC clock
calibration, which runs between early_time_init() and init_xen_time()).

In the course of this re-ordering also set the timer channel 2 gate low
after having finished calibration. This should be benign to overall
system operation, but appears to be the more clean state.

Also do away with open coded 8254 register manipulation from 8259 code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/i8259.c
xen/arch/x86/time.c